package mhwi.actions;

import com.megacrit.cardcrawl.actions.AbstractGameAction;
import com.megacrit.cardcrawl.actions.common.RemoveSpecificPowerAction;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import com.megacrit.cardcrawl.powers.AbstractPower;

public class RemovePowersAction extends AbstractGameAction {
    private AbstractPlayer p;
    private AbstractPower.PowerType type;

    public RemovePowersAction(AbstractPlayer target, AbstractPower.PowerType type) {
        this.p = target;
        this.type = type;
    }

    public RemovePowersAction(AbstractPlayer target) {
        this.p = target;
        this.type = AbstractPower.PowerType.DEBUFF;
    }

    @Override
    public void update() {
        for (AbstractPower power : p.powers) {
            if (power.type == this.type) {
                AbstractDungeon.actionManager.addToBottom(new RemoveSpecificPowerAction(p, p, power.ID));
            }
        }
        this.isDone = true;
    }
}
